<?php

namespace app\common\model;

class CourseChapterSection extends Base
{
    /**
     * getListByPid
     * @param $pid
     * @param $field
     * @return array
     * @throws
     */
    public function getListByPid($pid, $field = '*'): array
    {
        $where = [
            ['pid', 'in', $pid],
            ['status', '=', 1]
        ];
        $list = $this->where($where)->field($field)->order(['sort' => 'desc','id' => 'asc'])->select();
        return $list ? $list->toArray() : [];
    }
}